﻿Imports System.IO
Imports System.Xml.Serialization

Public Class GenericDeserializer(Of T)
    Public Shared Function DeserializeFromXML(ByVal anFileStream As FileStream) As T
        Dim myObject As T
        Dim mySerializer As XmlSerializer = New XmlSerializer(GetType(T))
        ' Call the Deserialize method and cast to the object type.
        myObject = CType(mySerializer.Deserialize(anFileStream), T)
        Return myObject
    End Function
End Class
